package win.zxshuo.www.model;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import win.zxshuo.www.entity.InternalConstant;


import java.util.Date;

@Document
public class ChapterModelMongoDB {

    @Id
    private String id;

    private Date createDate;

    private Date modifyDate;

    private Integer chapterOrder;

    private Long bookId;

    private Long orderNum =0L ;

    private String title;

    private String content;

    private String spiderUrl;

    private Integer chapterWordNum;

    private String spiderStatus = "0"; // 0 伪爬行 1已爬行，2爬行失败

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public ChapterModelMongoDB(){

    }

    public ChapterModelMongoDB(Long bookId,Long orderNum,String title,String content){
        this.createDate = new Date();
        this.modifyDate = new Date();
        this.bookId = bookId;
        this.orderNum = orderNum;
        this.title = title;
        this.content = content;
        this.spiderUrl = InternalConstant.SPIDER_LOCAL;
        this.chapterWordNum = content.length();
        this.spiderStatus = "1";
    }

    public ChapterModelMongoDB(Long bookId,Long orderNum,String title,String content,String spiderUrl){
        this.createDate = new Date();
        this.modifyDate = new Date();
        this.bookId = bookId;
        this.orderNum = orderNum;
        this.title = title;
        this.content = content;
        this.spiderUrl = spiderUrl;
        this.chapterWordNum = content.length();
        this.spiderStatus = "1";
    }

    public Integer getChapterOrder() {
        return chapterOrder;
    }

    public void setChapterOrder(Integer chapterOrder) {
        this.chapterOrder = chapterOrder;
    }

    public Long getOrderNum() {
        return orderNum;
    }

    public void setOrderNum(Long orderNum) {
        this.orderNum = orderNum;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public Date getModifyDate() {
        return modifyDate;
    }

    public void setModifyDate(Date modifyDate) {
        this.modifyDate = modifyDate;
    }

    public Long getBookId() {
        return bookId;
    }

    public void setBookId(Long bookId) {
        this.bookId = bookId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getSpiderUrl() {
        return spiderUrl;
    }

    public void setSpiderUrl(String spiderUrl) {
        this.spiderUrl = spiderUrl;
    }

    public Integer getChapterWordNum() {
        return chapterWordNum;
    }

    public void setChapterWordNum(Integer chapterWordNum) {
        this.chapterWordNum = chapterWordNum;
    }

    public String getSpiderStatus() {
        return spiderStatus;
    }

    public void setSpiderStatus(String spiderStatus) {
        this.spiderStatus = spiderStatus;
    }
}
